<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>

<body class="gray-bg">
	<div class="container-div ui-layout-center">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="hc-form">
					<!--<input type="hidden" id="deptId" name="deptId">
	                <input type="hidden" id="parentId" name="parentId">-->
					<div class="select-list">
						<ul>
							<li>
								考核周期：
								<select id="checkPeriod"  name="checkPeriod"  style="width: 100px" th:with="type=${@dict.getType('check_period')}">
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
								</select>
							</li>
							<li>
								完成情况：
								<select id="completeStatus"  name="completeStatus"  style="width: 100px" th:with="type=${@dict.getType('recruit_status')}">
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
								</select>
							</li>
							<li>
								考核单元：
								<select id="checkPdu"  name="checkPdu"  style="width: 100px" th:with="type=${@dict.getType('check_unit')}">
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
								</select>
							</li>
							<li>
								PDU：
								<select id="pdu"  name="pdu"  style="width: 100px" th:with="type=${@dict.getType('human_pdu')}">
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
								</select>
							</li>
							<li>
								地域：
								<select id="region"  name="region"  style="width: 100px" th:with="type=${@dict.getType('check_region')}">
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
								</select>
							</li>


							<li>
								<a class="btn btn-success btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-success btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>

				</form>
			</div>

	        <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
	<div th:include="include :: footer"></div>
	<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
	<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
	<script th:inline="javascript">
		var editFlag = [[${@permission.hasPermi('human:hc:edit')}]];
		var removeFlag = [[${@permission.hasPermi('human:hc:remove')}]];
		var datas = [[${@dict.getType('check_region')}]];
		var pduDatas = [[${@dict.getType('human_pdu')}]];
		var checkPduDatas = [[${@dict.getType('check_unit')}]];
		var completestatusDatas=[[${@dict.getType('recruit_status')}]];
		var prefix = ctx + "human/hc";

		//年月范围
		layui.use('laydate', function(){
		var laydate = layui.laydate;
		  laydate.render({
			elem: '#test8'
			,type: 'month'
			,theme: 'molv'
			,range: true,
			done: function(value, date) {
				var months = value.split(" - ");
			}
		  });
		 });

		$(function() {
			$('body').layout({ west__size: 185 });
			queryWorktimeList();
		});


		function queryWorktimeList() {
		    var options = {
		        url: prefix + "/list",
		        //createUrl: prefix + "/add",
		        updateUrl: prefix + "/edit/{id}",
		        //removeUrl: prefix + "/
		        modalName: "HC",
		        search: true,
		        showExport: false,
		        columns: [
		        {
		            title: '操作',
		            align: 'center',
		            width:"300",
		            formatter: function(value, row, index) {
		                var actions = [];
		                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.hcId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
		                return actions.join('');
		            }
		        },
		         {
		            title: 'Goose截图',
		            align: 'center',
		            width:"300",
		            formatter: function(value, row, index) {
		                var actions = [];
		                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="showGooseFile(\'' + row.goosePath + '\')"><i class="fa fa-edit"></i>查看截图</a> ');
		                return actions.join('');
		            }
		        },
		        {
		            field: 'hcId',
		            title: 'HC编号'
		        },
		        {
		            field: 'prjId',
		            title: '立项编码'
		        },
		        {
		            field: 'gooseFilePath',
		            title: 'Goose截图',
		            visible: false
		        },
		        {
		            field: 'sendDate',
		            title: '下发日期'
		        },
		        {
		            field: 'postName',
		            title: '岗位名称'
		        },
		        {
		            field: 'delegate',
		            title: '合作代表'
		        },
		        {
		            field: 'region',
		            title: '区域',
		            formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(datas, value);
		            }
		        },
		        {
		            field: 'pdu',
		            title: 'PDU',
		            formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(pduDatas, value);
		            }
		        },
		        {
		            field: 'checkPdu',
		            title: '考核单元',
		            formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(checkPduDatas, value);
		            }
		        },
		        {
		            field: 'humanInvalidDate',
		            title: '到期日期'
		        },
		        {
		            field: 'candidateName',
		            title: '候选人姓名'
		        },
		        {
		            field: 'wbCode',
		            title: '外包人员编号'
		        },
		        {
		            field: 'consumedDays',
		            title: '到位天数'
		        },
		        {
		            field: 'completeStatus',
		            title: '完成状态',
		            formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(completestatusDatas, value);
		            }
		        },
		        {
		            field: 'isoftPm',
		            title: '蚂蚁PM',
		            sortable: true
		        },
		        {
		            field: 'confirmHwLevel',
		            title: '候选人定级'
		        },
		        {
		            field: 'consumeDate',
		            title: '到位日期',
		            sortable: true
		        }]
		    };
		    $.table.init(options);
		}

		function showGooseFile(gooseFile){
			var bigH = 450;
			var bigW = 900;
			if(gooseFile===null||gooseFile==='null'){
				layer.open({content: "未上传Goose截图."});
				return;
			}
			layer.open({
				type: 1,
				title: false,
				closeBtn: 1,
				shadeClose: true,
				area: [bigW + 'px', bigH + 'px'], //宽高
				content: "<img width='"+bigW+"' height='"+bigH+"' src=/goose/" + gooseFile + " />"
			});
		}


		function edit(hcId) {
			var roleId = $("input[name='roleId']").val();
			var roleName = $("input[name='roleName']").val();
			var roleKey = $("input[name='roleKey']").val();
			var roleSort = $("input[name='roleSort']").val();
			var status = $("input[name='status']").is(':checked') == true ? 0 : 1;
			var remark = $("input[name='remark']").val();
			var menuIds = $.tree.getCheckedNodes();
			$.ajax({
				cache : true,
				type : "POST",
				url : ctx + "human/hc/edit",
				data : {
					"roleId": roleId,
					"roleName": roleName,
					"roleKey": roleKey,
					"roleSort": roleSort,
					"status": status,
					"remark": remark,
					"menuIds": menuIds
				},
				async : false,
				error : function(request) {
					$.modal.alertError("系统错误");
				},
				success : function(data) {
					$.operate.saveSuccess(data);
				}
			});
		}


	</script>
</body>
</html>